package file;

import java.io.DataInputStream;
import java.io.FileOutputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class serverFile {
	public static void main(String[] args) throws Exception{
		System.out.println("dang doi ket noi");
		ServerSocket svr=new ServerSocket(1111);
		Socket soc=svr.accept();
		DataInputStream input=new DataInputStream(soc.getInputStream());
		FileOutputStream out=new FileOutputStream("F:/fileluuhi.rar");
		byte[]data=new byte[1024];
		while(true){
			input.read(data);
			if((new String(data)).contains("end"))
				break;
			out.write(data);
			out.flush();
		}
		svr.close();out.close();
	}
}
